import 'package:city_pickers/city_pickers.dart';
import 'package:city_pickers/modal/result.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_switch/flutter_switch.dart';
import 'package:shenfuhui/config/config.dart';

import '../routers/routers.dart';
import '../views/dialog_manager.dart';

///
/// 资产互转
///
class MineAssetTransition extends StatefulWidget {
  const MineAssetTransition({Key? key}) : super(key: key);

  @override
  State<MineAssetTransition> createState() => _MineAssetTransitionState();
}

class _MineAssetTransitionState extends State<MineAssetTransition> {
  var _name = '';
  var _num = '';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Config.colorBg2,
      appBar: AppBar(
        title: const Text('互转'),
        centerTitle: true,
      ),
      body: SizedBox(
        width: double.infinity,
        height: double.infinity,
        child: Container(
          width: double.infinity,
          height: double.infinity,
          margin: EdgeInsets.symmetric(vertical: 25.w, horizontal: 25.w),
          child: Column(
            children: [
              Container(
                width: double.infinity,
                height: 140.w,
                padding: EdgeInsets.symmetric(vertical: 25.w, horizontal: 25.w),
                decoration: BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.circular(12.w),
                ),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      "可用资产金券",
                      style:
                          TextStyle(fontSize: 24.sp, color: Config.colorText1),
                    ),
                    Padding(
                      padding: EdgeInsets.only(top: 8.w),
                    ),
                    Text(
                      "0.0000",
                      style: TextStyle(
                          fontSize: 28.sp,
                          color: Config.colorMain,
                          fontWeight: FontWeight.bold),
                    ),
                  ],
                ),
              ),
              Container(
                width: double.infinity,
                padding: EdgeInsets.symmetric(vertical: 20.w, horizontal: 20.w),
                margin: EdgeInsets.only(top: 25.w),
                decoration: BoxDecoration(
                  color: (Config.colorWhite),
                  borderRadius: BorderRadius.circular(10.w),
                ),
                child: Column(
                  children: [
                    Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Container(
                          margin: EdgeInsets.symmetric(vertical: 5.w),
                          width: 100.w,
                          child: Text(
                            "转出对象",
                            style: TextStyle(fontSize: 25.sp),
                          ),
                        ),
                        Padding(
                          padding: EdgeInsets.only(left: 30.w),
                        ),
                        Container(
                          width: 500.w,
                          margin: EdgeInsets.symmetric(vertical: 5.w),
                          child: TextField(
                            keyboardType: TextInputType.number,
                            textAlign: TextAlign.justify,
                            obscureText: false,
                            maxLength: 10,
                            maxLines: 1,
                            onChanged: (value) {
                              setState(() {
                                _num = value;
                              });
                            },
                            style: TextStyle(
                                fontSize: 25.sp, color: Config.colorText1),
                            decoration: const InputDecoration(
                              hintStyle: TextStyle(color: Config.colorText3),
                              hintText: "请输入对方用户名",
                              counterText: '',
                              isDense: true,
                              border: InputBorder.none,
                              contentPadding: EdgeInsets.zero, //设置文本内容的Padding
                            ),
                          ),
                        ),
                      ],
                    ),
                    Divider(
                      color: Config.colorDivider,
                      height: 40.w,
                      thickness: 2.w,
                    ),
                    Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Container(
                          margin: EdgeInsets.symmetric(vertical: 5.w),
                          width: 100.w,
                          child: Text(
                            "转出数量",
                            style: TextStyle(fontSize: 25.sp),
                          ),
                        ),
                        Padding(
                          padding: EdgeInsets.only(left: 30.w),
                        ),
                        Container(
                          width: 500.w,
                          margin: EdgeInsets.symmetric(vertical: 5.w),
                          child: TextField(
                            keyboardType: TextInputType.number,
                            textAlign: TextAlign.justify,
                            obscureText: false,
                            maxLength: 10,
                            maxLines: 1,
                            onChanged: (value) {
                              setState(() {
                                _num = value;
                              });
                            },
                            style: TextStyle(
                                fontSize: 25.sp, color: Config.colorText1),
                            decoration: const InputDecoration(
                              hintStyle: TextStyle(color: Config.colorText3),
                              hintText: "请输入兑换数量",
                              counterText: '',
                              isDense: true,
                              border: InputBorder.none,
                              contentPadding: EdgeInsets.zero, //设置文本内容的Padding
                            ),
                          ),
                        ),
                      ],
                    ),
                  ],
                ),
              ),
              Container(
                width: 750.w,
                height: 100.w,
                padding: EdgeInsets.symmetric(vertical: 8.w, horizontal: 8.w),
                margin: EdgeInsets.only(top: 45.w),
                child: ElevatedButton(
                  clipBehavior: Clip.antiAlias,
                  onPressed: () => {
                    Routes.router.navigateTo(context, Routes.mineAddressEdit,
                        transition: TransitionType.inFromRight)
                  },
                  style: ElevatedButton.styleFrom(shape: const StadiumBorder()),
                  child: const Text('确定'),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
